package com.sourceQ.system.mapper.message.sms;

import com.sourceQ.common.mybatis.baseMapper.BaseMapperX;
import com.sourceQ.common.mybatis.query.QueryWrapperX;
import com.sourceQ.system.domain.message.sms.SysSmsCode;

/**
 * @author: SourceQ
 * @create: 2024-04-23 09:16
 * @Description:
 */
public interface SysSmsCodeMapper extends BaseMapperX<SysSmsCode> {

    default SysSmsCode selectLastByMobile(String mobile, String code, String scene){
        return selectOne(new QueryWrapperX<SysSmsCode>()
                .eq("mobile", mobile)
                .eqIfPresent("scene", scene)
                .eqIfPresent("code", code)
                .orderByDesc("id")
                .limitN(1));
    }
}
